Release 10.1A: OpenEdge Data Management:
DataServer for ORACLE
Record locking
OpenEdge applications rely on the ORACLE RDBMS to handle all record locking for the target ORACLE database. OpenEdge locks do not apply to your ORACLE database. Table 2–8 compares OpenEdge locks to their ORACLE equivalents.
Table 2–8: Progress 4GL and ORACLE locks OpenEdge lock ORACLE lock Transaction processing option lock1NO-LOCK None NoneSHARE-LOCK None NoneEXCLUSIVE-LOCKSHARE UPDATE(row-level)SHARE UPDATE(row-level)EXCLUSIVE-LOCK. . .UPDATESHARE UPDATE(row-level) . .EXCLUSIVE(table-level)SHARE UPDATE(row-level) ...ROW EXCLUSIVE(row-level)
1The ORACLE Transaction Processing option provides a low-level locking manager.
In applications that use the DataServer, locks occur as a result of Progress 4GL statements that the DataServer translates into SQL statements and sends to the ORACLE RDBMS.
Table 2–9 shows examples of Progress 4GL statements, the SQL statements they generate, and the resulting ORACLE locks in an ORACLE database. The examples assume the default is
SHARE-LOCK. The notes that follow the table help explain the locking behavior.
Table 2–9: ORACLE locking Progress 4GL statement SQL statements generated ORACLE
locks FIND customer. . . . UPDATE customer.1 SELECT . . . FROM customer SELECT . . . FROM customer FOR UPDATE; Compares records UPDATE customer . . . ;1None Share Update {Row} Exclusive2
1When the Progress 4GL encounters anUPDATEstatement that involves an ORACLE database, it uses aFIND . . . EXCLUSIVE-LOCKstatement to check whether the record referenced by theUPDATEstatement is already locked.
If the record in the buffer is locked, the Progress 4GL starts theUPDATE. If not, it immediately issues an SQLSELECT. . .FOR UPDATEstatement to determine whether the value in the buffer is the same as the value in the database. This statement also locks the record. If the values are different, the Progress 4GL returns a run-time error. When theSELECT. . .FOR UPDATEstatement completes successfully, theUPDATEstarts.
When the Progress 4GLUPDATEcompletes, the Progress 4GL generates an SQLUPDATEstatement that performs the actual change to the ORACLE database. For example, if you have to retrieve a record for a subsequent update, use theEXCLUSIVE-LOCKmodifier with theFINDstatement to avoid the secondSELECT. . .FOR UPDATEoperation.
NOTE: The last Progress 4GL statement in the table is an example of a lock upgrade.2If you use ORACLE with the Transaction Processing option, the result is a Row Exclusive Lock. Without Transaction Processing, the result is a table-level Exclusive Lock.
The Progress 4GL and ORACLE release locks at different points in a transaction. When an application issues an
UPDATE, the Progress 4GL releases the lock once the new data is input. ORACLE does not release the lock until the application issues aCOMMITorROLLBACK. The Progress 4GL allows you to hold a lock outside of a transaction or beyond a transaction’s scope, but ORACLE always releases all locks at the end of a transaction.See the ORACLE documentation for details on ORACLE locking. See OpenEdge Development: Progress 4GL Handbook for details on how the Progress 4GL transactions and locks work.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |